package com.future.mvc.web.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * <P>
 *
 * </p>
 *
 * @author yinhao
 * @version 1.0
 * @since 2024/9/7 17:43
 */
public class MyCharacterFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        // 设置编码格式
        servletRequest.setCharacterEncoding("UTF-8");
        // 放行请求
        filterChain.doFilter(servletRequest,servletResponse);

    }

    @Override
    public void destroy() {

    }
}
